<?php

/**
 * 案件记录
 */
class ExportController extends Controller_Base
{


    //案件管理列表
    public function indexAction()
    {
        $request = $this->getRequest();
        $page = intval($request->getQuery('page', 1));
        $exportType = $request->getQuery('exportType', 0);
        $limit = intval($request->getQuery('limit', 10));
        $page = $page ? $page : 1;
        $start = ($page - 1) * $limit;
        $where = $this->getWhere();
        $query = array('limit' => $limit);

        if ($exportType) {//按照案件号查询
            array_push($where, "exportType = '{$exportType}'");
        }
        $query['exportType'] = $exportType;
        $seacher = array(
            'where' => $where,
            'limit' => $limit,
            'start' => $start,
            'order' => 'id DESC'
        );
        $list = Module_Mediate_ExportData::getInstance()->getAllBySearch(array("*"), $seacher, true);
        $total = Module_Mediate_ExportData::getInstance()->getAllBySearch(array("count(*) as num"), array('where' => $where), true);

        $total = $total[0]['num'];
        $totalPage = ceil($total / $limit);
        $this->getMediator();
        //赋值资产方
        $this ->getAssets();
        SmartyAdapter::assign('arrList', $list);
        SmartyAdapter::assign('totalPage', $totalPage);
        SmartyAdapter::assign('totalnum', $total);
        SmartyAdapter::assign('pagesize', $limit);
        SmartyAdapter::assign('curPageNum', $page);
        SmartyAdapter::assign('query', $query);
        SmartyAdapter::assign('page_query', http_build_query($query));
    }


}
